<template>
  <div id="app">
    <h1>
      根组件 -{{title}}
    </h1>
    原生的获取方式：
    <input type="text" :value="this.$store.state.count" @input="handlerInput">
    <Son1></Son1>
    <hr>
    <Son2></Son2>
  </div>
</template>

<script>
import Son1 from './components/SonOne.vue'
import Son2 from './components/SonTwo.vue'
import {mapState} from 'vuex'

export default {
  name: 'app',
  components: {
    Son1,
    Son2
  },
  computed:{
    ...mapState(['title', 'count'])
  },
  methods:{
    handlerInput(e){
      this.$store.state.count = e.target.value

    }
  }
}
</script>

<style>
#app {
  width: 600px;
  margin: 20px auto;
  border: 3px solid #ccc;
  border-radius: 3px;
  padding: 10px;
}
</style>
